package net.shopxx.util;

import java.io.IOException;

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;

public class JacksonUtil
{
  private static final String IIIlIIIlII = "jacksonObjectMapper";

  public static ObjectMapper getMapper()
  {
    return (ObjectMapper)SpringUtil.getBean("jacksonObjectMapper");
  }

  public static String IIIIIIIl(Object paramObject)
  {
    ObjectMapper localObjectMapper = getMapper();
    try
    {
      return localObjectMapper.writeValueAsString(paramObject);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return null;
  }

  public static <T> T toObject(String paramString, Class<T> paramClass)
  {
    ObjectMapper localObjectMapper = getMapper();
    try
    {
      return localObjectMapper.readValue(paramString, paramClass);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return null;
  }

  public static <T> T IIIIIIII(String paramString, TypeReference paramTypeReference)
  {
    ObjectMapper localObjectMapper = getMapper();
    try {
		return localObjectMapper.readValue(paramString, paramTypeReference);
	} catch (JsonParseException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (JsonMappingException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
  }
}

/* Location:           D:\apache-tomcat-7.0.35\webapps\ROOT1\WEB-INF\classes\
 * Qualified Name:     net.shopxx.OOOO0O0O.IIIIIlII
 * JD-Core Version:    0.6.2
 */